﻿using System;
using System.Collections.Generic;

namespace BJoin.Application.Dto
{
    public class ReqPagingDto
    {
        /// <summary>
        /// 当前页码
        /// </summary>
        public virtual long CurrentPage { get; set; } = 0;
        /// <summary>
        /// 每页条目数
        /// </summary>
        public virtual long ItemsPerPage { get; set; } = 10;
    }
    public class ResPagingDto<T> where T : class
    {
        /// <summary>
        /// 总条目数
        /// </summary>
        public long TotalItems { get; set; }

        /// <summary>
        /// 每页条目数
        /// </summary>
        public long ItemsPerPage { get; set; }

        /// <summary>
        /// 当前页码
        /// </summary>
        public long CurrentPage { get; set; }
        /// <summary>
        /// 条目数据
        /// </summary>
        public IEnumerable<T> Items { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public long TotalPages
        {
            get { return (long)Math.Ceiling((decimal)TotalItems / ItemsPerPage); }
        }
    }
}
